home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / dev / e / jrhrkrm2.lzh / RKRM_PartTwo / Utility / tag1.e < prev    next >
Text File  |  1995-09-20  |  2KB  |  75 lines

  1. -> tag1.e
  2.  
  3. ->>> Header (globals)
  4. MODULE 'utility',
  5.        'intuition/intuition',
  6.        'utility/tagitem'
  7.  
  8. ENUM ERR_NONE, ERR_LIB, ERR_TAG, ERR_WIN
  9.  
  10. RAISE ERR_LIB IF OpenLibrary()=NIL,
  11.       ERR_TAG IF AllocateTagItems()=NIL,
  12.       ERR_WIN IF OpenWindowTagList()=NIL
  13. ->>>
  14.  
  15. ->>> PROC main()
  16. PROC main() HANDLE
  17.   DEF tags=NIL:PTR TO tagitem, win=NIL
  18.   KickVersion(37)
  19.   -> We need the utility library for this example
  20.   utilitybase:=OpenLibrary('utility.library', 37)
  21.  
  22.   -> *********************************************************************
  23.   -> This section allocates a tag array, fills it in with values, and then
  24.   -> uses it.
  25.   -> *********************************************************************
  26.  
  27.   -> Allocate a tag array
  28.   tags:=AllocateTagItems(7)
  29.   -> Fill in our tag array
  30.   tags[0].tag:=WA_WIDTH
  31.   tags[0].data:=320
  32.   tags[1].tag:=WA_HEIGHT
  33.   tags[1].data:=50
  34.   tags[2].tag:=WA_TITLE
  35.   tags[2].data:='RKM Tag Example 1'
  36.   tags[3].tag:=WA_IDCMP
  37.   tags[3].data:=IDCMP_CLOSEWINDOW
  38.   tags[4].tag:=WA_CLOSEGADGET
  39.   tags[4].data:=TRUE
  40.   tags[5].tag:=WA_DRAGBAR
  41.   tags[5].data:=TRUE
  42.   tags[6].tag:=TAG_DONE
  43.  
  44.   -> Open the window, using the tag attributes as the only description.
  45.   win:=OpenWindowTagList(NIL, tags)
  46.   -> Wait for an event to occur
  47.   WaitIMessage(win)
  48.  
  49.   -> Close the window now that we're done with it
  50.   CloseWindow(win)
  51.   win:=NIL  -> E-Note: help with error trapping
  52.  
  53.   -> *********************************************************************
  54.   -> This section builds a static tag list, and passes it to the function.
  55.   -> *********************************************************************
  56.  
  57.   win:=OpenWindowTagList(NIL,
  58.                         [WA_WIDTH, 320,
  59.                          WA_HEIGHT, 50,
  60.                          WA_TITLE, 'RKM Tag Example 1',
  61.                          WA_IDCMP, IDCMP_CLOSEWINDOW,
  62.                          WA_CLOSEGADGET, TRUE,
  63.                          WA_DRAGBAR, TRUE,
  64.                          TAG_DONE])
  65.   -> Wait for an event to occur
  66.   WaitIMessage(win)
  67. EXCEPT DO
  68.   IF win THEN CloseWindow(win)
  69.   IF tags THEN FreeTagItems(tags)
  70.   IF utilitybase THEN CloseLibrary(utilitybase)
  71. ENDPROC
  72. ->>>
  73.  
  74.  
  75.